package com.changgou.search.listener;

import com.changgou.search.config.RabbitMQConfig;
import com.changgou.search.service.ESManagerService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author kfzhao
 * @version 1.0
 * @className GoodsDelListener
 * @description
 * @date 2021/12/28 0:19
 */
@Component
public class GoodsDelListener {

    @Autowired
    private ESManagerService esManagerService;

    @RabbitListener(queues = RabbitMQConfig.SEARCH_DEL_QUEUE)
    public void receiveMessage(String spuId) {
        System.out.println("删除索引库监听类接收到的spuId " + spuId);

        // 调用业务层完成删除
        esManagerService.delDataBySpuId(spuId);
    }
}
